// locutor
// (c) 2008-2009, Normen Müller, normen.mueller@gmail.com  
// $Id$
package locutor.moc

import java.io.File

import scala.xml.{Elem}

import scalaxx.diff.{Command}

import locutor.dg._

/** A document model
 * 
 * @todo empty document model
 * @todo ℰ should be a set of equiv-relations; think of kiama strategies; if so xmldiff has to be adapted accordingly
 * 
 * @author <a href="mailto:normen.mueller@googlemail.com">Normen M&#xFC;ller</a>
 * @version 0.0.5 */
trait ℳ {
  type T
  val g: Option[DG]
  val e: Set[ℰ[T]]
  val r: Option[ℛ]
  
  def ripple(commands: List[Command]) = error("not yet implemented")
  def ↩ (commands: List[Command]) = error("not yet implemented")
}

/** An equivalence model
 * 
 * @todo just trait Equiv[T]
 * 
 * @author <a href="mailto:normen.mueller@googlemail.com">Normen M&#xFC;ller</a>
 * @version 0.0.5 */
trait ℰ[-T] {
  
}

/** A rule system
 * 
 * @author <a href="mailto:normen.mueller@googlemail.com">Normen M&#xFC;ller</a>
 * @version 0.0.5 */
trait ℛ {
  
}

/** 
 * @author <a href="mailto:normen.mueller@googlemail.com">Normen M&#xFC;ller</a>
 * @version 0.0.5 */
trait MoC {
  type T
  def infoset(f: File): (T, ℳ) = (astOf(f), modelOf(f))
  protected def astOf(f: File): T
  protected def modelOf(f: File): ℳ
}

trait XMLDocument {
  def parse(f: File): Elem = xml.XML.loadFile(f)
}

// class DocBook extends XMLDocument with Differ with MoC
class DocBook extends XMLDocument with MoC {
  type T = Elem
  private val prelude: ℳ = error("not yet implemented")
  
  def astOf(f: File) = parse(f)
  protected def modelOf(f: File) = error("not yet implemented")
}
